﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="vendor/jquery/jquery.min.min.js"></script>
    <script>
        var params = [];
        var isWorkItem = true;
        getUrlVars = function (RedirctUrl) {
            var vars = {};
            var hash;
            var hashs = RedirctUrl.slice(RedirctUrl.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashs.length; i++) {
                hash = hashs[i].split('=');
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
        $(function () {
            var url = window.location.href;
            if (url.indexOf("InstanceDetail") > -1) {
                var RedirctUrl = url.substring(url.indexOf("?") + 5, url.length);
                window.localStorage.setItem("H3.redirectUrl", url);
                window.location.href = RedirctUrl;
            } else {
                var RedirctUrl = url.substring(url.indexOf("?") + 5, url.length);
                //获取URL参数
                params = getUrlVars(RedirctUrl);
                var paramString = JSON.stringify(params);
                $.ajax({
                    type: "POST",
                    async: false,
                    url: "WorkItemSheets/WorkItemSheets",
                    data: { paramString: paramString },
                    dataType: "json",
                    success: function (data) {
                        if (data.Success) {
                            window.location.href = data.Message;
                        } else {
                            var url = window.location.href;
                            window.localStorage.setItem("H3.redirectUrl", url);
                            window.location.href = "index.html#/platform/login";
                        }
                    },
                    error: function (data) {
                        window.location.href = "index.html#/platform/login";
                    }
                });
            }
        })
    </script>
</head>
<body>
</body>
</html>
